<!DOCTYPE HTML>
<html>

<head>
    <meta charset="utf-8">
    <title>Helio赫粒</title>
    <meta name="viewport" content="width=device-width,initial-scale=1, minimum-scale=1, maximum-scale=1, user-scalable=no" />
    <meta name="apple-mobile-web-app-capable" content="yes" />
    <meta name="full-screen" content="true" />
    <meta name="screen-orientation" content="portrait" />
    <meta name="x5-fullscreen" content="true" />
    <meta name="360-fullscreen" content="true" />
    <style>
        html, body {
            -ms-touch-action: none;
            background: #888888;
            padding: 0;
            border: 0;
            margin: 0;
            height: 100%;
        }
    </style>
</head>
<audio src="resource/bg.mp3" preload="preload" autoplay loop id="music_mp3"></audio>
<body>
    <div style="margin: auto;width: 100%;height: 100%;overflow: hidden;" class="egret-player" data-orientation="portrait" data-frame-rate="30" data-scale-mode="showAll" data-content-width="750"
data-content-height="1334" data-multi-fingered="2" data-entry-class="Main" data-show-paint-rect="false" data-show-fps="false"
data-show-log="false" data-show-fps-style="x:0,y:0,size:12,textColor:0xffffff,bgAlpha:0.9" >
</div>
<script>

    //监听旧版的微信api接口
    document.addEventListener("WeixinJSBridgeReady", function() {
        WeixinJSBridge.invoke('getNetworkType', {}, function(e) {
            var music_mp3 = document.getElementById('music_mp3');
            music_mp3.play();
            music_mp3.volume = 1;
        });
    }, false);

    var loadScript = function (list, callback) {
        var loaded = 0;
        var loadNext = function () {
            loadSingleScript(list[loaded], function () {
                loaded++;
                if (loaded >= list.length) {
                    callback();
                }
                else {
                    loadNext();
                }
            })
        };
        loadNext();
    };

    var loadSingleScript = function (src, callback) {
        var s = document.createElement('script');
        s.async = false;
        s.src = src;
        s.addEventListener('load', function () {
            s.parentNode.removeChild(s);
            s.removeEventListener('load', arguments.callee, false);
            callback();
        }, false);
        document.body.appendChild(s);
    };

    var xhr = new XMLHttpRequest();
    xhr.open('GET', './manifest.json?v=' + Math.random(), true);
    xhr.addEventListener("load", function () {
        var manifest = JSON.parse(xhr.response);
        var list = manifest.initial.concat(manifest.game);
        loadScript(list, function () {
            paper.Transform = egret3d.Transform;
            paper.Quaternion = egret3d.Quaternion;
            paper.MeshFilter = egret3d.MeshFilter;
            paper.MeshRenderer = egret3d.MeshRenderer;
            paper.Vector3 = egret3d.Vector3;

            egret3d.runEgret({
                antialias: true,
                alpha: false,
                audioType: 1
            });
            heavenlyBody.run();
            egret.web.Html5Capatibility._audioType = 2
            egret.web.Html5Capatibility.$init();
        });
    });
    xhr.send(null);
</script>
</body>

</html>